#include <vector>
#include <QDebug>
#include <qfont.h>
#include "grid.h"

grid::grid(int x, int y, int type) {
    //-----维护方块信息-----
    this->posx = x;
    this->posy = y;
    this->type = type;
    this->marked = false;
    this->setFixedSize(40, 40);
    if (type == 1) this->nowtype = 1;
    else this->nowtype = 0;
    finished = false;
}

//-----右键双击标记-----
void grid::mouseDoubleClickEvent(QMouseEvent *e) {
    if (e->button() == Qt::RightButton) {
        if (!marked) {
            marked = true;
            QFont font;
            font.setPointSize(20);
            this->setFont(font);
            this->setText("★");
        } else {
            marked = false;
            this->setText("");
        }
        //----触发信号 重新统计剩余雷数----
        emit this->change_num();
    }

};
